﻿<UserControl x:Class="EzDesk.DesktopClient.View.SelfInfoView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:view="clr-namespace:EzDesk.DesktopClient.View" mc:Ignorable="d" 
             d:DesignHeight="45" d:DesignWidth="303">
    <Grid>
        <Grid Margin="5">
            <Grid Width="64" Margin="-60,15,0,-40" HorizontalAlignment="Left" VerticalAlignment="Top" Height="64">
                <Grid.Effect>
                    <DropShadowEffect Color="#FF7CBAFF" ShadowDepth="2" BlurRadius="8"/>
                </Grid.Effect>
                <Rectangle Fill="#FF7BB9FF" Stroke="#FF999999" RadiusX="5" RadiusY="5"/>
                <Rectangle Fill="#FFD5D5D5" RadiusY="4" RadiusX="4" HorizontalAlignment="Center" VerticalAlignment="Center" Width="60" Height="60">
                    <Rectangle.Effect>
                        <DropShadowEffect Opacity="0.3" BlurRadius="2" ShadowDepth="2" Direction="120"/>
                    </Rectangle.Effect>
                </Rectangle>
                <Image Source="{Binding UserProfileModel.HeadUrl,Converter={StaticResource StringToImageSource}}" Width="60" Height="60"  Stretch="UniformToFill"/>
            </Grid>

            <StackPanel Orientation="Vertical" TextBlock.FontSize="14" VerticalAlignment="Top" Margin="20,15,0,0">
                <!--<Image  Source="{DynamicResource UserStatus}" Width="16"/>-->
                <TextBlock>
                    <TextBlock Text="{Binding UserProfileModel.Name}"  FontWeight="Bold"/>
                    <TextBlock Foreground="{StaticResource FontGray}" Margin="5,0,0,0">[ <Run Text="{Binding UserProfileModel.Dept.DeptName,TargetNullValue=软件开发部}"></Run><Run Text=" - "></Run><Run Text="{Binding UserProfileModel.Position.Description}"></Run> ]</TextBlock>
                </TextBlock>
                <StackPanel Orientation="Horizontal">
                    <ComboBox ItemsSource="{Binding TodoFeeds}"  ButtonBase.Click="ComboBox_Click" Width="200" SelectedItem="{Binding SelectedTodoFeed,TargetNullValue=暂时没有任务}" SelectedIndex="0" Margin="0,0,5,0">
                        <ComboBox.ItemContainerStyleSelector>
                            <view:TodoComboBoxContainerStyleSelector/>
                        </ComboBox.ItemContainerStyleSelector>
                        <!--<ComboBox.ItemTemplateSelector>
                            <view:TodoComboxDataTemplateSelector/>
                        </ComboBox.ItemTemplateSelector>-->
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <ContentControl  HorizontalAlignment="Stretch" Content="{Binding ContentTitle,Converter={StaticResource XamlConverter}}"></ContentControl> 
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                        <ComboBox.Resources>
                            <Style x:Key="completedContainerStyle" TargetType="{x:Type ComboBoxItem}">
                                <Setter Property="HorizontalContentAlignment"  Value="Stretch"/>
                                <Setter Property="IsEnabled" Value="False"></Setter>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                                            <Grid Opacity="0.6"   HorizontalAlignment="Stretch">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="auto"></ColumnDefinition>
                                                    <ColumnDefinition Width="*"></ColumnDefinition>
                                                </Grid.ColumnDefinitions>
                                                <Ellipse Grid.Column="0"  Width="10" Height="10" Fill="Green"></Ellipse >
                                                <ContentPresenter Grid.Column="1"  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                            <Style x:Key="todoContainerStyle" TargetType="{x:Type ComboBoxItem}">
                                <Setter Property="HorizontalContentAlignment"  Value="Stretch"/>
                                <Setter Property="VerticalContentAlignment" Value="Bottom"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                                            <Grid  HorizontalAlignment="Stretch">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="auto"></ColumnDefinition>
                                                    <ColumnDefinition Width="*"></ColumnDefinition>
                                                    <ColumnDefinition Width="auto"></ColumnDefinition>
                                                </Grid.ColumnDefinitions>
                                                <Ellipse Grid.Column="0"  Margin="2,0"  Width="10" Height="10" Fill="Blue"></Ellipse>
                                                <ContentPresenter Grid.Column="1"  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                                <StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Bottom">
                                                    <TextBlock Text="设为当前" VerticalAlignment="Bottom" Cursor="Hand"></TextBlock>
                                                    <Button Content="@"  ></Button>
                                                </StackPanel>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                            <DataTemplate x:Key="completedTodoTemplate">
                                <ContentControl  Content="{Binding ContentTitle,Converter={StaticResource XamlConverter}}"></ContentControl>
                            </DataTemplate>
                            <DataTemplate x:Key="todoTemplate" >
                                
                                    <StackPanel  Opacity="0.6"  Orientation="Horizontal" HorizontalAlignment="Stretch">
                                        <Ellipse Width="10" Height="10" Fill="Blue"></Ellipse>
                                        <ContentControl  Content="{Binding ContentTitle,Converter={StaticResource XamlConverter}}"></ContentControl>
                                        <Button Content="@"></Button>
                                    </StackPanel>
                                
                            </DataTemplate>
                        </ComboBox.Resources>
                    </ComboBox>
                    <Button Content="添加任务" Command="{Binding AddTodoCommand}"></Button>
                </StackPanel>
            </StackPanel>

            <Image  Source="{StaticResource Logo}" HorizontalAlignment="Right" Height="58" VerticalAlignment="Top"/>
        </Grid>
    </Grid>
</UserControl>
